/**
 *
 * 建造等待动画
 * @author 
 *
 */
class BuildWait extends egret.Sprite {
    private bm: egret.Bitmap;
    
    private buildType: any = { "AttackTower01": "building1","ShieldTower01": "building2","MagicTower01": "building3","AttackTower02": "building1","ShieldTower02": "building2","MagicTower02": "building3","ExploTower01": "building4","GoldOre01": "building4","SpellTower01": "building3","Strengthen01": "building4"};
    
	public constructor(name:string) {
        super();

        console.log(name);
        this.bm = Utils.createBitmapByName(name);
        this.addChild(this.bm);
        this.anchorOffsetX = this.width / 2;
        this.anchorOffsetY = this.height-10;
        
        this.bm = Utils.createBitmapByName("buildbarbg");
        this.bm.x = 5;
        this.bm.y = -5;
        this.addChild(this.bm);
        
        this.bm = Utils.createBitmapByName("buildbartop");
        this.bm.x = 5;
        this.bm.y = -5;
        this.bm.width = 1;//37
        this.addChild(this.bm);
        
        this.building();
        //播放音效
        if(name == "s04"){
            SoundManager.playEffect("levelUpwoman_mp3");
        }else{
            SoundManager.playEffect("levelUpMan_mp3");
        }

	}
	
	private building(){
        var that = this;
        TweenLite.to(this.bm,1.5,{width: 37,ease:Linear.easeNone,onComplete: function() {
            that.dispatchEvent(new ToolEvent(ToolEvent.BUILD_COMP));
            }
        });
	}
}
